package com.database.objects;

import java.io.*;
import java.text.ParseException;

import javax.persistence.*;

import com.load.utils.DateUtil;

@Embeddable
public class Data implements Serializable {

	private static final long serialVersionUID = 2766176979842506137L;

	@Column(name = "num_commits", nullable = false)
	private Integer numCommits = 0;

	@Column(name = "num_files", nullable = false)
	private Integer numFiles = 0;

	@Column(name = "num_classes", nullable = false)
	private Integer numClasses = 0;

	@Column(name = "num_methods", nullable = false)
	private Integer numMethods = 0;

	@Column(name = "num_lines", nullable = false)
	private Integer numLines = 0;

	@Column(name = "start_date", nullable = false)
	private String startDate = "";

	public Data() {

	}

	public Data(Integer numCommits, Integer numFiles, Integer numClasses, Integer numMethods, Integer numLines, String startDate) {
		super();
		this.numCommits = numCommits;
		this.numFiles = numFiles;
		this.numClasses = numClasses;
		this.numMethods = numMethods;
		this.numLines = numLines;
		this.startDate = startDate;
	}

	public Integer getNumCommits() {
		return numCommits;
	}

	public Integer getNumFiles() {
		return numFiles;
	}

	public Integer getNumClasses() {
		return numClasses;
	}

	public Integer getNumMethods() {
		return numMethods;
	}

	public Integer getNumLines() {
		return numLines;
	}

	public String getStartDate() {
		return startDate;
	}

	public String getDuration() throws ParseException {
		return DateUtil.formatPeriod(startDate);
	}

}